﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using FTchina;
using FTchina.Library;
namespace FTchina.Pages
{
    /// <summary>
    ///menu 的摘要说明
    /// </summary>
    public class menu : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            FTchina.basic.CheckUserIP(this);
            FTchina.basic.CheckAdmin(this);

            if (!IsPostBack)
            {
                MakeMenuTree();
            }
        }


        protected string MakeMenuTree()
        {
            //将tempwords处理到缓存中

            string tempwords = string.Empty;
            tempwords = "<script type='text/javascript'> d = new dTree('d'); d.add(0, -1, '操作导航');";

            //处理到缓存中

            using (DataTable dt = shujuku.GetDataTable("select * from menulist  order by paixu desc,id asc "))
            {
                foreach (DataRow dr in dt.Rows)
                {

                    if (dr["power"].ToString().Contains(MasterHelper.MasterPower) || dr["power"].ToString() == "")
                    {
                        tempwords += "	d.add(" + dr["id"] + ", " + dr["ParentID"] + ", '" + dr["context"] + "', '" + dr["link"] + "','" + dr["context"] + "','mainFrame');";
                    }
                }


                tempwords += "  document.write(d);</script>";


                return tempwords;
            }

        }





    }
}